/*
 * @Author: wuhao930406 1148547900@qq.com
 * @Date: 2023-07-14 13:36:06
 * @LastEditors: wuhao930406 1148547900@qq.com
 * @LastEditTime: 2023-10-08 10:10:09
 * @FilePath: /legion-iot/src/pages/dashboard/components/Overview.jsx
 * @Description:
 *
 * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
 */
import React, { useState, useEffect } from "react";
import ReactECharts from "echarts-for-react";
import * as echarts from "echarts";
import { theme } from "antd";
import { useAsyncEffect } from "ahooks";
import VideoPlayer from "../../dashboard3d/components/VideoPlayer";
import { getFetch } from "@/utils/doFetch";


let barTopColor = [
  "#CBB835",
  "#33C6E2",
  "#16B5FF",
  "#ff4800",
  "#8F48F0",
  "#CD597A",
];
let barBottomColor = [
  "#D09311",
  "#279AB0",
  "#0B5FFF",
  "red",
  "#670BFF",
  "#90222D",
];

function Overview({ data }) {
  const [infos, setInfos] = useState({});
  const {
    token: {
      colorBgContainer,
      colorTextBase,
      colorBgSecondary,
      colorPrimary,
      colorBgThird,
      colorBorder,
    },
  } = theme.useToken();

  useAsyncEffect(async () => {
    let res = await getFetch({
      url: "/device/hik_hls_stream",
      params: {
        id: 7,
      },
    });
    setInfos(res?.data);
  }, []);

  return (
    <div style={{ flex: 1, overflow: "hidden",margin:"12px 0",borderRadius:6 }}>
      <VideoPlayer source={infos?.url ?? "rtmp://media3.sinovision.net:1935/live/livestream"} />
    </div>
  );
}

export default Overview;
